package com.epfresh.api.utils;

import com.epfresh.supplier.entity.StaffInfo;
import java.util.Map;

public class MarketPermissionUtil {
    //预登记
    public static final String marketPreRegistration = "root.market.pre.registration";
    //缴费
    public static final String marketPay = "root.market.pay";
    //进场登记
    public static final String marketOis = "root.market.ois";
    //检测报告
    public static final String marketDetection = "root.market.detection";
    //我的合同
    public static final String marketMyDetection = "root.market.my.detection";
    //我的车辆
    public static final String marketMyCar = "root.market.my.car";
    //变价
    public static final String appSupplierProductPrice = "root.app.supplier.product.price";
    //收款
    public static final String appSupplierToIncome = "root.app.supplier.toIncome";
    //销售订单
    public static final String appSupplierOrder = "root.app.supplier.order";
    //现货商品
    public static final String appSupplierProductSelling = "root.app.supplier.product.selling";
    //我的收入
    public static final String appSupplierIncome = "root.app.supplier.income";
    //我的台账
    public static final String appSupplierProductStanding_book = "root.app.supplier.standing_book";
    //进货管理
    public static final String appSupplierProductPurchase = "root.app.supplier.product.purchase";
    //减免退
    public static final String appSupplierOrderJmt = "root.app.supplier.order.jmt";
    //客户管理
    public static final String appSupplierCustomer = "root.app.supplier.customer";
    //员工管理
    public static final String appSupplierEmployee = "root.app.supplier.employee";
    //我的店铺
    public static final String appSupplierStore = "root.app.supplier.store";
    //预售商品
    public static final String appSupplierProductPresell = "root.app.supplier.product.presell";
    //备货
    public static final String appSupplierJointOrder = "root.app.supplier.joint.order";
    //抢单
    public static final String appSupplierProductOften_order = "root.app.supplier.product.often_order";
    //联营报价
    public static final String appSupplierJointProduct = "root.app.supplier.joint.product";
    //评价
    public static final String appSupplierComment = "root.app.supplier.comment";
    //优惠券
    public static final String appSupplierCoupon = "root.app.supplier.coupon";


    //是否有批发市场的权限
    public static boolean isMarketPermission(StaffInfo staffInfo) {
        if (staffInfo == null || staffInfo.getResources() == null) return false;
        Map<String, Object> map = staffInfo.getResources();
        if (map.containsKey(marketOis) || map.containsKey(marketDetection) || map.containsKey(marketMyDetection)
                || map.containsKey(marketMyCar) || map.containsKey(marketPreRegistration) || map.containsKey(marketPay)) {
            return true;
        }
        return false;
    }

    //是否有批发市场的缴费权限
    public static boolean isMarketPayPermission(StaffInfo staffInfo) {
        if (staffInfo == null || staffInfo.getResources() == null) return false;
        Map<String, Object> map = staffInfo.getResources();
        if (map.containsKey(marketPay)) {
            return true;
        }
        return false;
    }
}
